package com.zyx.camunda.config;

import org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin;
import org.camunda.bpm.spring.boot.starter.configuration.Ordering;
import org.camunda.bpm.spring.boot.starter.event.EventPublisherPlugin;
import org.camunda.bpm.spring.boot.starter.property.CamundaBpmProperties;
import org.camunda.bpm.spring.boot.starter.property.EventingProperty;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

/**
 * <a href="http://camunda-cn.shaochenfeng.com/user-guide/spring-boot-integration/configuration/">自定义camunda配置</a>

 *
 * @author Yaxi.Zhang
 * @since 2022/10/18 01:02
 */
@Configuration
public class MyCamundaConfiguration {

    @Bean
    @Order(Ordering.DEFAULT_ORDER + 1)
    public ProcessEnginePlugin myCustomConfiguration(CamundaBpmProperties properties, ApplicationEventPublisher publisher) {
        return new MyCustomConfiguration(properties.getEventing(), publisher);
    }

}
